package cn.edu.ptu.jobfairs.basic.enums;

/**
 * Created by Lin Chenxiao on 2020-08-25
 **/
public enum MemberStatus {
    LOCKED(0, "不可用"),
    HR(1, "人事处"),
    LEADER(2, "院级领导"),
    USER(3, "普通职员"),
    ADMIN(4, "管理员");

    private final int value;

    MemberStatus(int value, String desc) {
        this.value = value;
    }

    public static String nameOf(Integer value) {
        if (value == null) return "unknown";
        for (MemberStatus memberStatus : values()) {
            if (memberStatus.value == value) return memberStatus.name().toLowerCase();
        }
        return "unknown";
    }

    public static boolean exists(Integer value) {
        if (value == null) return false;
        for (MemberStatus memberStatus : values()) {
            if (memberStatus.value == value) return true;
        }
        return false;
    }

    public int getValue() {
        return value;
    }
}
